#ifndef PM_PANEL_TAG_SUMMARY_H_INCLUDED
#define PM_PANEL_TAG_SUMMARY_H_INCLUDED

#include "paneltagsummarygui.h"
#include "pm/tagsummary.h"

class PanelTagSummary : public PanelTagSummaryGui
{
	enum COLS {
		COL_NAME,
		COL_PERCENT
	};
	
	struct Summary {
		pm::TagSummary tagSummary;
		double         totalCost;
		
		Summary(const pm::TagSummary& s, double estimation)
		: tagSummary(s)
		, totalCost(estimation)
		{
		}
		
		const wxString& name() const { return tagSummary.tag_name(); }
		double percent() const { return 100.0 * (tagSummary.cost() / totalCost); }
	};
	
public:
	PanelTagSummary(wxWindow* parent);

protected:
	void ReloadTagSummary();
	
	void AddTagSummary(const Summary& summary);
	void SetTagSummary(long item, const Summary& summary);

	void OnProjectLoaded(wxCommandEvent& event);
	void OnTagSummaryChanged(wxNotifyEvent& event);
};

#endif // PM_PANEL_TAG_SUMMARY_H_INCLUDED
